import time

from tqdm import trange

from NanNing.common import RadarTEST, send_data, RadarData

if __name__ == '__main__':
    # DBM中配置了雷达外推确认次数 1 次
    # DBM中配置了雷达外推次数 2 次
    # 按指定周期发送数据
    periods_stop = 2  # 连续停止的周期数
    periods_start = 5  # 连续发送的周期数

    for i in trange(1000):
        if i % (periods_stop + periods_start) < periods_start:
            # SSR A6430
            send_data(RadarTEST.HOST, RadarTEST.PORT2, RadarData.Radar1)
            time.sleep(3.99)  # 发送数据会耗时
        else:
            time.sleep(4)
            continue
